<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<s:set name="status_name" value="%{@com.japp.tools.common.SelectVal@ctStatus(c.c_status)}"></s:set>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>客户管理</title>
<s:include value="/app_common/common.jsp"></s:include>
<!-- 日期选择框start -->
<script type="text/javascript" src="<s:property value='webctx'/>/libs/js/form/datePicker/WdatePicker.js"></script>
<!-- 日期选择框end -->
<!--数字分页start-->
<script type="text/javascript" src="<s:property value='webctx'/>/libs/js/nav/pageNumber.js"></script>
<!--数字分页end-->
<!-- 用户选择start -->
<script type="text/javascript" src="<s:property value='webctx'/>/app_common/userPopup/queryUser.js"></script>
<!-- 用户选择end -->
</head>
<body>
<form name="form1" id="form1" action="<s:property value='webctx'/>/ct/ct_queryCustomer.action" method="post">
<s:hidden name="c.c_status"></s:hidden>
	
<div class="box2" panelTitle="功能面板" id="searchPanel">
	<div style="text-align: center;font-weight: bold;"><s:property value="status_name"/>管理</div>
	
		<table class="noclass" width="100%">
			<tr>
				<td>客户编码：</td>
				<td><input type="text" name="c.c_code" value="<s:property value='c.c_code'/>"/></td>
				<td>客户名称：</td>
				<td><input type="text" name="c.c_name" value="<s:property value='c.c_name'/>"/></td>
				<td>所属地区:</td>
				<td><select name="c.c_area" selectedValue="<s:property value='c.c_area'/>" prompt="请选择" data='<s:property value="map.sel_2"/>'></select></td>
			<tr>
				<td>客户来源:</td>
				<td><select name="c.c_source" selectedValue="<s:property value='c.c_source'/>" prompt="请选择" data='<s:property value="map.sel_4"/>'></select></td>
				<td>开户日期：</td>
				<td><input type="text" name="c.c_num_date" value="<s:property value='c.c_num_date'/>" class="date" style="cursor: pointer;"/></td>
				<td>客户分类：</td>
				<td><select name="c.c_type" selectedValue="<s:property value='c.c_type'/>" prompt="请选择" data='<s:property value="map.sel_3"/>'></select></td>
			</tr>
			<!-- 权限 -->
			<s:if test="#session.u_power!=3">
			<tr>
				<s:if test="#session.u_power == 1 ||#session.u_power == 0">
					<td>所属部门:</td><td>
					<select name="c.c_suoshu_dpcode" id="query_dp_code" selectedvalue="<s:property value='c.c_suoshu_dpcode'/>" prompt="请选择" url='<s:property value="webctx"/>/dp/dp_getJsonDpCode.action'></select></td>
					<td>经纪人:</td>
					<td>
					<input id="user_code" type="hidden">
					<input type="text" id="user_name" name="c.c_suoshu_uname" style="cursor: pointer;" onclick="queryUserAll()" readonly="readonly" class="query_user" value="<s:property value='c.c_suoshu_uname'/>" />
					</td>			
				</s:if>
				<s:else>
					<td>经纪人:</td>
					<td>
					<input id="user_code" type="hidden">
					<s:hidden id="query_dp_id" value="%{#session.userltd}"></s:hidden>
					<input type="text" id="user_name" name="c.c_suoshu_uname" style="cursor: pointer;" onclick="queryUserAll()" readonly="readonly" class="query_user" value="<s:property value='c.c_suoshu_uname'/>" /></td>			
				</s:else>
				<s:if test="c.c_status==1 || c.c_status==2">
					<td>最终状态:</td>
					<td colspan="5"><s:select headerKey="" headerValue="请选择" list="#{1:'计划开户',2:'放弃',3:'继续跟踪',4:'交由他人跟踪' }" value="%{c.c_type_status}"  name="c.c_type_status"></s:select></td>
				</s:if>
			</tr>
			</s:if>
			<s:else>
				<s:if test="c.c_status==1 || c.c_status==2">
				<tr>
					<td>最终状态:</td>
					<td colspan="5"><s:select headerKey="" headerValue="请选择" list="#{1:'计划开户',2:'放弃',3:'继续跟踪',4:'交由他人跟踪' }" value="%{c.c_type_status}"  name="c.c_type_status"></s:select></td>
				</tr>
				</s:if>
			</s:else>
			<tr>
				<td colspan="6" align="center" >
					<button type="button" onclick="resets()"><span class="icon_reload">重置</span></button>&nbsp;
					<button type="button" onclick="search()"><span class="icon_find">查询</span></button>
				</td>
			</tr>
		</table>
</div>
<div class="box_tool_min padding_top2 padding_bottom2 padding_right5">
	<div class="center">
		<div class="left">
			<div class="right">
				<div class="padding_top5 padding_left10">
					<s:if test="c.c_status==1">
					<a href="javascript:;" onclick="onInsert()"><span class="icon_add">新增<s:property value="status_name"/></span></a>
					<div class="box_tool_line"></div>
					</s:if>
					<a href="javascript:;" onclick="onDelete(null)"><span class="icon_delete">批量删除</span></a>
					<div class="clear"></div>
				</div>
			</div>
		</div>
	</div>
	<div class="clear"></div>
</div>
<div id="scrollContent" class="border_gray">
<table class="tableStyle" thTrueWidth="true"  useCheckBox="true" mode="list" fixedCellHeight="true">
		<tr style="width: 100%">
			<th width="25"></th>
			<th>客户编码</th>
			<th>客户名称</th>
			<th>所属分部</th>
			<th>所属营业部</th>
			<th>纪人代码</th>
			<th>经纪人名称</th>
			<th>开户日期</th>
			<th>客户分类</th>
			<th>客户来源</th>
			<th>所属地区</th>
			<th>办公电话</th>
			<th>手机</th>
			<th>QQ</th>
			<th>类型</th>
			<th>状态</th>
			<th width="50">操作</th>
		</tr>
		<s:iterator value="page.result" status="stat">
		<tr ondblclick="onEdit(<s:property value="c_id"/>)">
			<td width="25"><input name="keys" type="checkbox" value="<s:property value="u_id"/>" /></td>
			<td><s:property value="c_code"/></td>
			<td><s:property value="c_name"/></td>
			<td><s:property value="c_suoshu_dpname"/></td>
			<td><s:property value="c_suoshu_yyb"/></td>
			<td><s:property value="c_suoshu_ucode"/></td>
			<td><s:property value="c_suoshu_uname"/></td>
			<td><s:property value="c_num_date.substring(0,10)"/></td>
			<td><s:property value="c_type"/></td>
			<td><s:property value="c_source"/></td>
			<td><s:property value="c_area"/></td>
			<td><s:property value="c_phone"/></td>
			<td><s:property value="c_mobile_hone"/></td>
			<td><s:property value="c_qq"/></td>
			<td><s:property value="c_status"/></td>
			<td><s:property value="c_type_status==1?'计划开户':c_type_status==2?'放弃':c_type_status==3?'继续跟踪':'交由他人跟踪'"/></td>
			<td width="50" align="center">
				<!-- span class="img_view hand" title="查看" onclick="onView(<s:property value="c_id"/>)"></span> -->
				<span class="img_edit hand" title="修改" onclick="onEdit(<s:property value="c_id"/>)"></span>
				<span class="img_delete hand" title="删除" onclick="onDelete(<s:property value="c_id"/>)"></span>
			</td>
		</tr>
		</s:iterator>
	</table>
</div>
<!-- 分页 -->
<div style="height:35px;">
	<div class="float_left padding5">共查询<s:property value='total'/>条数据</div>
	<div class="float_right padding5">
		<div class="pageNumber" total="<s:property value='total'/>" page="<s:property value='currentPage-1'/>" pageSize="<s:property value='size'/>" showSelect="true" showInput="true" id="page"></div>
	</div>
	<div class="clear"></div>
</div>
<s:hidden name="currentPage"/>
<s:hidden name="size"/>
</form>
</body>
<script type="text/javascript">
//分页事件
$("#page").bind("pageChange",function(e,index){
	showProgressBar();
	$('#currentPage').val(index+1);
	document.form1.submit();
}).bind("sizeChange",function(e,num){
	showProgressBar();
	$('#size').val(num);
	document.form1.submit();
});
//搜索
function search(){
	showProgressBar();
	document.form1.submit();
}
//重置
function resets(){
	$('.noclass input').val('');
	var opt = $('#u_sex option:eq(0)');
	opt.attr('selected',true);
	$('.noclass .selectbox').val(opt.text());
}
//新增
function onInsert(){
	showProgressBar();
	window.location = webctx+"/ct/ct_yinserCustomer.action?c.c_status="+$('#c_c_status').val();
}
//修改
function onEdit(obj){
	showProgressBar();
	window.location = webctx+"/ct/ct_yupdateCustomer.action?c.c_id="+obj+"&c.c_status="+$('#c_c_status').val();
}
//删除
function onDelete(obj){
	top.Dialog.confirm("确认删除所选项?",function(){
		//单个删除
		if(obj==null){
			if($('input[name="keys"]:checked').length==0){
				top.Dialog.alert("请选择需要删除的客户!");
				closeProgress();
				return false;
			}
		}
		showProgressBar();
		document.form1.action = webctx+"/ct/ct_deleteCustomer.action"+(obj!=null&&obj!=''?'?keys='+obj:'');
		document.form1.submit();
	});
}
$(function(){
	var result = "<s:property value='result'/>";
	if(result!=null&&result!=''){
		top.Dialog.alert(result);
	}
});
</script>
</html>